//    Copyright (C) Kherty.  All rights reserved.
using System.Text;

namespace OpenLS.Spreadsheet.Expressions
{
    class RowReferenceToken: DimensionReferenceToken
    {
        public RowReferenceToken(int firstIndex, bool firstLocked, int secondIndex, bool secondLocked) : base(firstIndex, firstLocked, secondIndex, secondLocked)
        {
        }
        public override RangeReference Project(Worksheet worksheet)
        {
            return new FullRowRangeReference(
                new AnchoredRowReference(worksheet.Rows[FirstIndex], FirstlLocked),
                new AnchoredRowReference(worksheet.Rows[SecondIndex], SecondLocked)
                );
        }
        public override string GetText(OpenLS.Spreadsheet.Parsing.CellNamingConvention convention)
        {
            StringBuilder result = new StringBuilder();
            result.Append(convention.GetRowName(FirstIndex, FirstlLocked));
            result.Append(":");
            result.Append(convention.GetRowName(SecondIndex, SecondLocked));
            return result.ToString();
        }

    }
}